package 泛型;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;

public class 抽奖泛型<T> {
    Random random = new Random();
//    奖品池
    ArrayList<T> 奖品列表 = new ArrayList<>();
    private T name;

    public 抽奖泛型(T name) {
        this.name = name;
    }

    public void 添加奖品(T name) {
        奖品列表.add(name);
    }

    public T 抽奖() {
        return 奖品列表.get(random.nextInt(奖品列表.size()));
    }

    public T getName() {
        return name;
    }

    public void setName(T name) {
        this.name = name;
    }
}
